// pages/index/index.js
Page({
  data: {
    userInfo: {},
    latestOrders: []
  },
  onLoad: function (options) {
    // 页面加载时获取用户信息和最新订单
    this.getUserInfo()
    this.getLatestOrders()
  },
  getUserInfo: function() {
    // 模拟获取用户信息
    this.setData({
      userInfo: {
        nickName: '张三',
        avatarUrl: '/path/to/avatar.png'
      }
    })
  },
  getLatestOrders: function() {
    // 模拟获取最新订单
    this.setData({
      latestOrders: [
        { id: 1, title: '订单1', status: '待支付', amount: 99.99 },
        { id: 2, title: '订单2', status: '已支付', amount: 199.99 }
      ]
    })
  },
  goToOrders: function() {
    wx.switchTab({
      url: '/pages/orders/orders',
    })
  }
})
